import request from '@/utils/request'

// ========== 库存入库API ==========

// 查询库存入库列表
export function listStockInbound(query) {
  return request({
    url: '/business/stock/inbound/list',
    method: 'get',
    params: query
  })
}

// 查询库存入库详细
export function getStockInbound(inboundId) {
  return request({
    url: '/business/stock/inbound/' + inboundId,
    method: 'get'
  })
}

// ========== 退货入库API ==========

// 查询退货入库列表
export function listStockReturn(query) {
  return request({
    url: '/business/stock/return/list',
    method: 'get',
    params: query
  })
}

// 查询退货入库详细
export function getStockReturn(returnId) {
  return request({
    url: '/business/stock/return/' + returnId,
    method: 'get'
  })
}

// 新增退货入库
export function addStockReturn(data) {
  return request({
    url: '/business/stock/return',
    method: 'post',
    data: data
  })
}

// 修改退货入库
export function updateStockReturn(data) {
  return request({
    url: '/business/stock/return',
    method: 'put',
    data: data
  })
}

// 删除退货入库
export function delStockReturn(returnId) {
  return request({
    url: '/business/stock/return/' + returnId,
    method: 'delete'
  })
}

// ========== 备货出库API ==========

// 查询备货出库列表
export function listStockOutbound(query) {
  return request({
    url: '/business/stock/outbound/list',
    method: 'get',
    params: query
  })
}

// 查询备货出库详细
export function getStockOutbound(outboundId) {
  return request({
    url: '/business/stock/outbound/' + outboundId,
    method: 'get'
  })
}

// 新增备货出库
export function addStockOutbound(data) {
  return request({
    url: '/business/stock/outbound',
    method: 'post',
    data: data
  })
}

// 修改备货出库
export function updateStockOutbound(data) {
  return request({
    url: '/business/stock/outbound',
    method: 'put',
    data: data
  })
}

// 删除备货出库
export function delStockOutbound(outboundId) {
  return request({
    url: '/business/stock/outbound/' + outboundId,
    method: 'delete'
  })
}

// 导入备货出库数据
export function importStockOutbound(data) {
  return request({
    url: '/business/stock/outbound/importData',
    method: 'post',
    data: data
  })
}

// 下载备货出库导入模板
export function importStockOutboundTemplate() {
  return request({
    url: '/business/stock/outbound/importTemplate',
    method: 'post',
    responseType: 'blob'
  })
}

// ========== 库存记录API ==========

// 查询库存记录列表（合并入库和出库）
export function listStockRecord(query) {
  return request({
    url: '/business/stock/record/list',
    method: 'get',
    params: query
  })
}

// ========== 库存明细API ==========

// 查询库存明细统计
export function getStockDetail(query) {
  return request({
    url: '/business/stock/detail/list',
    method: 'get',
    params: query
  })
}

